package Class::Scaffold::Test;

# $Id: Test.pm 13666 2007-11-07 07:53:28Z gr $

use strict;
use warnings;
use Test::More;
use Class::Value;  # see run() below


our $VERSION = '0.05';


# Also inherit from Class::Scaffold::Base so we get a delegate; put it first
# so its new() is found, not the very basic new() from Project::Build::Test

use base qw(
    Class::Scaffold::Base
    Test::CompanionClasses::Base
);


use constant PLAN => 1;


sub obj_ok {
    my ($self, $object, $object_type_const) = @_;
    isa_ok($object, $self->delegate->
        get_class_name_for($object_type_const)
    );
}


# Override planned_test_count() with a version that uses every_list().
# Project::Build::Test->planned_test_count() couldn't use that because
# every_list() is implemented in Data::Inherited, which in turn uses
# Project::Build.

sub planned_test_count {
    my $self = shift;
    my $plan;

    # so that PLANs can use the delegate:
    $::delegate = $self->delegate;

    $plan += $_ for $self->every_list('PLAN');
    $plan;
}


sub run {
    my $self = shift;
    $self->SUPER::run(@_);

    # check that test prerequisites are ok

    is($Class::Value::SkipChecks, 0, '$Class::Value::SkipChecks is off');
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - large-scale OOP application support

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

